nethackfandomcom-20200214-history
Source:NetHack 3.1.0/macconf.h
Below is the full text to macconf.h from the source code of NetHack 3.1.0. To link to a particular line, write [[NetHack 3.1.0/macconf.h#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code 1. /* SCCS Id: @(#)macconf.h 3.1 91/07/14 */ 2. /* Copyright © Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3. /* NetHack may be freely redistributed. See license for details. */ 4. 5. #ifdef MAC 6. # ifndef MACCONF_H 7. # define MACCONF_H 8. 9. /* 10. * Select your compiler... 11. * This could probably be automagic later on - I believe there's 12. * a unique symbol for MPW at least (it's "macintosh") 13. */ 14. # define MAC_MPW32 /* Headers, and for avoiding a bug */ 15. /* # define MAC_THINKC5 /* Maybe supported now ... */ 16. 17. # define RANDOM 18. # define NO_SIGNAL /* You wouldn't believe our signals ... */ 19. # define FILENAME 256 20. 21. # include "system.h" 22. 23. typedef long off_t ; 24. 25. /* 26. * Try and keep the number of files here to an ABSOLUTE minimum ! 27. * include the relevant files in the relevant .c files instead ! 28. */ 29. # include 30. # include 31. # include 32. # include 33. # include 34. # include 35. # include 36. # include 37. # include 38. 39. /* 40. * We could use the PSN under sys 7 here ... 41. */ 42. # define getpid() 1 43. # define getuid() 1 44. # define index strchr 45. # define rindex strrchr 46. 47. # define Rand random 48. 49. # define error progerror 50. 51. # if defined(VISION_TABLES) && defined(BRACES) 52. # undef BRACES 53. # endif 54. 55. /* 56. * macfile.c 57. * MAC file I/O routines 58. */ 59. 60. extern int maccreat ( const char * name , long fileType ) ; 61. extern int macopen ( const char * name , int flags , long fileType ) ; 62. extern int macclose ( int fd ) ; 63. extern int macread ( int fd , void * ptr , unsigned ) ; 64. extern int macwrite ( int fd , void * ptr , unsigned ) ; 65. extern long macseek ( int fd , long pos , short whence ) ; 66. 67. 68. # if !defined(O_WRONLY) 69. # include 70. # endif 71. 72. #if !defined(SPEC_LEV) && !defined(DGN_COMP) 73. # define creat maccreat 74. # define open macopen 75. # define close macclose 76. # define read macread 77. # define write macwrite 78. # define lseek macseek 79. #endif 80. 81. # define TEXT_TYPE 'TEXT' 82. # define LEVL_TYPE 'LEVL' 83. # define BONE_TYPE 'BONE' 84. # define SAVE_TYPE 'SAVE' 85. # define PREF_TYPE 'PREF' 86. # define DATA_TYPE 'DATA' 87. # define MAC_CREATOR 'nh31' /* Registered with DTS ! */ 88. 89. typedef struct macdirs { 90. Str32 dataName ; 91. short dataRefNum ; 92. long dataDirID ; 93. 94. Str32 saveName ; 95. short saveRefNum ; 96. long saveDirID ; 97. 98. Str32 levelName ; 99. short levelRefNum ; 100. long levelDirID ; 101. } MacDirs ; 102. 103. typedef struct macflags { 104. Bitfield ( processes , 1 ) ; 105. Bitfield ( color , 1 ) ; 106. Bitfield ( folders , 1 ) ; 107. Bitfield ( tempMem , 1 ) ; 108. Bitfield ( help , 1 ) ; 109. Bitfield ( fsSpec , 1 ) ; 110. Bitfield ( trueType , 1 ) ; 111. Bitfield ( aux , 1 ) ; 112. Bitfield ( alias , 1 ) ; 113. Bitfield ( standardFile , 1 ) ; 114. } MacFlags ; 115. 116. extern MacDirs theDirs ; 117. extern MacFlags macFlags ; 118. 119. /* 120. * Mac windows 121. */ 122. #define NUM_MACWINDOWS 15 123. #define TEXT_BLOCK 512L 124. #define WIN_BASE_RES 128 125. #define WIN_BASE_KIND 128 126. #define NUM_MENU_ITEMS 60 /* We've run out of letters by then ... */ 127. #define CHAR_ENTER ((char)3) 128. #define CHAR_BS ((char)8) 129. #define CHAR_LF ((char)10) 130. #define CHAR_CR ((char)13) 131. #define CHAR_ESC ((char)27) 132. #define CHAR_BLANK ((char)32) 133. #define CHAR_DELETE ((char)127) 134. 135. #define MAC_GRAPHICS_ENV 136. 137. /* Window constants */ 138. #define kMapWindow 0 139. #define kStatusWindow 1 140. #define kMessageWindow 2 141. #define kTextWindow 3 142. #define kMenuWindow 4 143. #define kLastWindowKind kMenuWindow 144. 145. extern Boolean RetrievePosition ( short , short * , short * ) ; 146. extern Boolean RetrieveSize ( short , short , short , short * , short * ) ; 147. extern void SavePosition ( short , short , short ) ; 148. extern void SaveSize ( short , short , short ) ; 149. extern void SaveWindowPos ( WindowPtr ) ; 150. extern void SaveWindowSize ( WindowPtr ) ; 151. 152. /* 153. * This determines the minimum logical line length in text windows 154. * That is; even if physical width is less, this is where line breaks 155. * go at the minimum. 350 is about right for score lines with a 156. * geneva 10 pt font. 157. */ 158. #define MIN_RIGHT 350 159. 160. #define NUM_CANCEL_ITEMS 10 161. 162. typedef struct NhWindow { 163. WindowPtr theWindow ; 164. short kind ; 165. void ( * keyFunc ) ( EventRecord * , WindowPtr ) ; 166. void ( * clickFunc ) ( EventRecord * , WindowPtr ) ; 167. void ( * updateFunc ) ( EventRecord * , WindowPtr ) ; 168. void ( * cursorFunc ) ( EventRecord * , WindowPtr , RgnHandle ) ; 169. Handle windowText ; 170. long windowTextLen ; 171. long textBase ; 172. Point cursor ; /* In CHARS / LINES */ 173. short leading ; 174. short charHeight ; 175. short charWidth ; 176. short fontNum ; 177. short fontSize ; 178. short lin ; /* Used by menus */ 179. short wid ; /* Used by menus */ 180. char itemChars [ NUM_MENU_ITEMS ] ; 181. char cancelStr [ NUM_CANCEL_ITEMS ] ; 182. char cancelChar ; 183. char clear ; 184. char cursorDrawn ; 185. short scrollPos ; 186. ControlHandle scrollBar ; 187. } NhWindow ; 188. 189. #define NUM_STAT_ROWS 2 190. #define NUM_ROWS 22 191. #define NUM_COLS 81 /* We shouldn't use column 0 */ 192. 193. typedef struct MapData { 194. char map [ NUM_ROWS ] [ NUM_COLS ] ; 195. } MapData ; 196. 197. typedef struct StatusData { 198. char map [ NUM_STAT_ROWS ] [ NUM_COLS ] ; 199. } StatusData ; 200. 201. extern NhWindow * theWindows ; 202. 203. extern struct window_procs mac_procs ; 204. 205. extern short text_wind_font; 206. #define set_text_wind_font(fnt) (text_wind_font = fnt) 207. #define mono_font() set_text_wind_font(monaco) 208. #define normal_font() set_text_wind_font(geneva) 209. 210. #define E extern 211. 212. /* 213. * Define PORT_HELP to be the name of the port-specfic help file. 214. * This file is included into the resource fork of the application. 215. */ 216. #define PORT_HELP "MacHelp" 217. 218. E void NDECL(port_help); 219. 220. E void NDECL(mac_init_nhwindows); 221. E void NDECL(mac_player_selection); 222. E void NDECL(mac_askname); 223. E void NDECL(mac_get_nh_event) ; 224. E void FDECL(mac_exit_nhwindows, (const char *)); 225. E void FDECL(mac_suspend_nhwindows, (const char *)); 226. E void NDECL(mac_resume_nhwindows); 227. E winid FDECL(mac_create_nhwindow, (int)); 228. E void FDECL(mac_clear_nhwindow, (winid)); 229. E void FDECL(mac_display_nhwindow, (winid, BOOLEAN_P)); 230. E void FDECL(mac_destroy_nhwindow, (winid)); 231. E void FDECL(mac_curs, (winid,int,int)); 232. E void FDECL(mac_putstr, (winid, int, const char *)); 233. E void FDECL(mac_display_file, (const char *, BOOLEAN_P)); 234. E void FDECL(mac_start_menu, (winid)); 235. E void FDECL(mac_add_menu, (winid, CHAR_P, int, const char *)); 236. E void FDECL(mac_end_menu, (winid, CHAR_P, const char *, const char *)); 237. E char FDECL(mac_select_menu, (winid)); 238. E void NDECL(mac_update_inventory); 239. E void NDECL(mac_mark_synch); 240. E void NDECL(mac_wait_synch); 241. #ifdef CLIPPING 242. E void FDECL(mac_cliparound, (int, int)); 243. #endif 244. E void FDECL(mac_print_glyph, (winid,XCHAR_P,XCHAR_P,int)); 245. E void FDECL(mac_raw_print, (const char *)); 246. E void FDECL(mac_raw_print_bold, (const char *)); 247. E int NDECL(mac_nhgetch); 248. E int FDECL(mac_nh_poskey, (int *, int *, int *)); 249. E void NDECL(mac_nhbell); 250. E int NDECL(mac_doprev_message); 251. E char FDECL(mac_yn_function, (const char *, const char *, CHAR_P)); 252. E void FDECL(mac_getlin, (const char *,char *)); 253. #ifdef COM_COMPL 254. E void FDECL(mac_get_ext_cmd, (char *)); 255. #endif /* COM_COMPL */ 256. E void FDECL(mac_number_pad, (int)); 257. E void NDECL(mac_delay_output); 258. 259. /* defined in macwin.c and exported for used in mmodal.c */ 260. E void FDECL(HandleEvent, (EventRecord *)); 261. 262. /* defined in mmodal.c */ 263. E DialogPtr FDECL(mv_get_new_dialog, (short)); 264. E void FDECL(mv_close_dialog, (DialogPtr)); 265. E void FDECL(mv_modal_dialog, (ModalFilterProcPtr, short *)); 266. 267. #undef E 268. 269. extern void DimMenuBar ( void ) ; 270. extern void UndimMenuBar ( void ) ; 271. extern int SanePositions ( void ) ; 272. 273. #define NHW_BASE 0 274. extern winid BASE_WINDOW , WIN_MAP , WIN_MESSAGE , WIN_INVEN , WIN_STATUS ; 275. 276. extern Boolean itworked( short ); 277. extern void mustwork( short ); 278. extern void VDECL(progerror, (const char *,...)); 279. extern void attemptingto( char * ); 280. extern void pushattemptingto( char * ); 281. extern void popattempt( void ); 282. extern void UnloadAllSegments( void ); 283. extern void InitSegMgmt( void * ); 284. extern void IsResident ( void * ); 285. extern void NotResident ( void * ); 286. 287. # endif /* ! MACCONF_H */ 288. #endif /* MAC */ macconf.h